/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package shared;

import java.io.Serializable;

/**
 *
 * @author latata_2
 */
public class Card implements Serializable {
    public static final int NONE_SUIT = 0; // żadny kolor (dla jokerów)
    public static final int HEART = 1; // kier
    public static final int DIAMOND = 2; // karo
    public static final int CLUB = 3; // trefl
    public static final int SPADE = 4; // pik
    
    public static final int TWO = 2;
    public static final int THREE = 3;
    public static final int FOUR = 4;
    public static final int FIVE = 5;
    public static final int SIX = 6;
    public static final int SEVEN = 7;
    public static final int EIGHT = 8;
    public static final int NINE = 9;
    public static final int TEN = 10;
    public static final int JACK = 11; // walet
    public static final int QUEEN = 12; // dama
    public static final int KING = 13; // król
    public static final int ACE = 14;// as
    public static final int JOKER = 15; // jocker
    private int suit;
    private int type;
    
    private Card asJoker = null;

    public Card(int suit, int type) {
        if(type == JOKER) suit = NONE_SUIT;
        this.suit = suit;
        this.type = type;
    }
    
    public Card(int suit, int type, Card asJocker)
    {
        this.suit = suit;
        this.type = type;
        this.asJoker = asJocker;
    }
   
    public void setAsJoker(Card asJoker) {
        this.asJoker = asJoker;
    }

    public Card getAsJoker() {
        return asJoker;
    }

    public boolean isStartCard() {
        if((type >= FIVE && type <= TEN) || type == QUEEN) {
            return true;
        }
        return false;
    }

    public int getSuit() {
        return suit;
    }

    public int getType() {
        return type;
    }
    
    @Override
    public String toString() {
        return "TYPE=" + type + ", SUIT=" + suit;
    }
}

